#ifndef CAMERAJSON_H
#define CAMERAJSON_H

#include <QObject>
#include <QTcpSocket>
#include <QTimer>
#include <QTextCodec>
#include <QPixmap>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <QScriptEngine>
#include <QScriptValue>
#include <QScriptValueIterator>
#include "cJSON.h"
#include <QtEndian>
#define LINK_TIME   10000   //最大空闲时间
#define DELAY_TIME   500
class CameraJson : public QObject
{
    Q_OBJECT
public:
    explicit CameraJson(QObject *parent = 0);
    QTcpSocket *tcp_socket;
    QByteArray picBuffer;
    QByteArray packHeader;
    QString camerarIp;
    QTimer *link_Timer;
signals:
     void carNumberRec(QString carNum,QPixmap *pic);
private:
    bool ServerConnected;
    int socket_cot;
public slots:
    void linkTimerOver();
    void socket_link(QString ip);
    void socket_rec();
    void socket_connected();
    void socket_desconnected();
    void displayshortError(QAbstractSocket::SocketError);
    QString GetIvsresult();
    QString OpenDev(int falg);
    void GetHend(QString);
    void socket_send();
    void GetSocket_Count();
};

#endif // CAMERAJSON_H
